<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0">
	<title>axios创建实例对象</title>
	<link rel="stylesheet" href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.min.css" crossorigin="anonymous">
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/1.7.8/axios.min.js"></script>
</head>
<body>
	<div class="container">
		<h2 class="page-header">基本使用</h2>
		<button class="btn btn-primary"> 发送GET请求 </button>
		<button class="btn btn-warning"> 发送POST请求 </button>
	</div>
	<script>
		// 获取按钮
		const btns = document.querySelectorAll('button');
		// 创建实例对象 /getJoke
		const duanzi = axios.create({
			baseURL:'https://api.apiopen.top',
			timeout:2000,
		})

		const another = axios.create({
			baseURL:'https://b.com',
			timeout:2000,
		})
		// 这里 duanzi 与 axios 对象的功能近是一样的
		//duanzi({
		//	url:'/api/sentences'
		//}).then(response =>{
		//	console.log(response);
		//})
	</script>
</body>
</html>